package com.cskaoyan.javase.oop3._2inner._4anonymous._4exercise;

/**
 * 补全程序,不修改main方法
 * 使得程序输出"hello world"
 * @since 11:17
 * @author wuguidong@cskaoyan.onaliyun.com
 */

public class Test {
    public static void main(String[] args) {
        Outer.method().show();
    }
}

interface Inter {
    void show();
}

class Outer {
    public static Inter method() {
        // return new InterImpl();
        /*class InterImplInner implements Inter{
            @Override
            public void show() {
                System.out.println("hello world!");
            }
        }
        return new InterImplInner();*/
        return new Inter() {
            @Override
            public void show() {
                System.out.println("hello world!");
            }
        };
        // Lambada表达式的实现
        // return () -> System.out.println("hello world!");
    }
}

class InterImpl implements Inter {
    @Override
    public void show() {
        System.out.println("hello world!");
    }
}